import java.util.Arrays;

public class J07maopao {
    public static void main(String[] args) {
        /*
        {67, 42, 88, 16, 25, 3}

        小 - 大

         */
        int[] arr = {67, 42, 88, 16, 25, 3};
        // 控制循环次数,每循环一次，ok一个数据
        for (int i = 1; i <= arr.length-1; i++) {
            // i=1  2
            for (int j = 0; j <= arr.length-1-i; j++) {
                if(arr[j]>arr[j+1]){
                    //发现左侧的更大，交换位置
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}

class J07maopao2 {
    public static void main(String[] args) {
        int[] arr = {67, 42, 88, 16, 25, 3};
        // 控制循环次数,每循环一次，ok一个数据
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if(arr[j]>arr[j+1]){
                    //发现左侧的更大，交换位置
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
